<%@page import="itsm.isperp.framework.core.context.ContextHolder"%><%@ page
	language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
  String path = request.getContextPath();
			String basePath = ContextHolder.getWebServerName(request);
%>

<div data-role="content" class="ui-content" role="main"
	style="background-color:#f8f8f8;position:absolute;left:0;right:0;bottom:0;top:0;">
	<div class="box">
		<form method="post" id="formid"
			action="<%=basePath%>api/wechat/userAccount/saveInfo">
			<input type="hidden" name="id" value="${model.id}" /> <input
				type="hidden" name="cl" value="${cl}" />
			<c:choose>
				<c:when test="${cl eq 'birthDayDayAndMonth'}">
					<div class="page__bd">
						<div class="weui-cells__title">修改-生日</div>
						<div class="weui-cells">
							<div class="weui-cell weui-cell_select weui-cell_select-after">
								<div class="weui-cell__hd">
									<label for="" class="weui-label">月</label>
								</div>
								<div class="weui-cell__bd">
									<select id="idYear" style="display:none" name="idYear" data=""
										data-allow-empty="false" data-width="40px"></select> <select
										class="weui-select formRequired" id="idMonth" data-valid="出生月"
										name="birthdayMonth">

									</select>
								</div>
							</div>
							<div class="weui-cell weui-cell_select weui-cell_select-after">
								<div class="weui-cell__hd">
									<label for="" class="weui-label ">日</label>
								</div>
								<div class="weui-cell__bd">
									<select class="weui-select formRequired" id="idDay"
										name="birthdayDay" data-valid="出生日">

									</select>
								</div>
							</div>
						</div>

					</div>
				</c:when>
				<c:otherwise>
					<div class="page__bd">
						<div class="weui-cells__title">修改-${fn }</div>
						<div class="weui-cell " style="background-color:white">

							<div class="weui-cell__bd weui-cell_primary">
								<input id="${cl }" name="${cl }" class="weui-input"
									value="${ov }" type="text" placeholder="请输入${fn }">
							</div>
							<div class="weui-cell_ft" style="display: none">
								<i class="weui_icon_warn"></i>
							</div>
						</div>

					</div>
				</c:otherwise>
			</c:choose>



			<a class="weui-btn weui-btn_primary" onclick="takeSubmit()"> 保存 </a>

		</form>
	</div>

</div>
<script>

    var myDate = new Date();
    var d=1;
    var m=1;
    if("${model.birthdayMonth}"!="")
    {
      m='${model.birthdayMonth}';
    }
    if("${model.birthdayDay}"!="")
    {
      d='${model.birthdayDay}';
    }
	$("#dateSelector").DateSelector({
	    ctlYearId : 'idYear',
	    ctlMonthId : 'idMonth',
	    defYear : 2000,
	    defMonth : m,
	    defDay : d,
	    ctlDayId : 'idDay',
	    minYear : 2000,
	    maxYear : 2100
	});

    var subing = false;

	function takeSubmit() {
		var validReult = true;
		var message = "请填写：";

		$("form .formRequired").each(function(index, item) {
			var me = $(item);
			var t = me.is("input:checkbox") || me.is("input:radio"), tValue = "";
			if (t) {
				var tName = me.attr("name");
				tValue = me.find("input[name='" + tName + "']:checked").val();
			} else {
				tValue = me.val();
			}

			if ((tValue == "" || tValue == undefined)) {

				message += "" + me.data("valid") + "、";
				validReult = false;
			}

		});
		message = message.substring(0, message.length - 1);
		if (!validReult) {
			$.weui.alert({
				text : message
			});
			return false;
		}

		if (subing == false) {
			subing = true;
			$("#formid").submit();
			return true;
		}
	}
</script>
